<%inherit file="base.html"/>

<%def name="head()">
<script>
    function deleteGwid(gwid_id)
    {
        if(confirm("确认删除吗？"))
        {
            window.location.href = "/gwid/delete?gwid_id="+gwid_id;
        }
    }
</script>
</%def>

<%def name="body()">
<section class="content">
<div class="box">
    <div class="panel-heading"><i class="fa fa-sitemap"></i> GWID信息列表</div>
        <div class="panel-body">
            <div class="container">
                % if permit.match(current_user.username,'/gwid/add'):
                <div class="pull-right bottom10">
                     <a href="/gwid/add" class="btn btn-sm btn-default">增加GWID信息</a>
                </div>
                % endif

                <table class="table table-hover">
                    <thead>
                        <tr>
                            <th>域编码</th>
                            <th>GWID</th>
                            <th>GWID描述</th>
                            <th>操作</th>
                        </tr>
                    </thead>
                    <tbody>
                        % for item in page_data.result:
                            <tr>
                                <td>${item.domain_code}</td>
                                <td>${item.gwid}</td>
                                <td>${item.gwid_desc}</td>
                                <td>
                                    % if permit.match(current_user.username,'/gwid/update'):
                                    <a class="opt-btn btn-default" href="/gwid/update?gwid_id=${item.id}">修改</a>
                                    % endif
                                    % if permit.match(current_user.username,'/gwid/delete'):
                                    <a class="opt-btn btn-default" href="javascript:deleteGwid('${item.id}')">删除</a>
                                    % endif
                                </td>
                            </tr>
                        % endfor
                    </tbody>
                </table>
                ${page_data.render()}
            </div>
        </div>
    </div>
</section>
</%def>